Some(ref toml) => add_unused_keys(&mut manifest, toml, "".to_string()),
None => {}
}
+ if manifest.get_targets().len() == 0 {
+ return Err(human(format!("either a [[lib]] or [[bin]] section must \
+ be present")))
+ }
return Ok((manifest, paths));
fn add_unused_keys(m: &mut Manifest, toml: &toml::Value, key: String) {
process(p.bin("foo")),
execs().with_stdout("i am foo\n"));
})
+
+test!(missing_lib_and_bin {
+ let mut p = project("foo");
+ p = p
+ .file("Cargo.toml", r#"
+ [package]
+
+ name = "test"
+ version = "0.0.0"
+ authors = []
+ "#);
+ assert_that(p.cargo_process("cargo-build"),
+ execs().with_status(101)
+ .with_stderr("either a [[lib]] or [[bin]] section \
+ must be present\n"));
+})
[dependencies.bar]
path = "src/bar"
+
+ [[lib]]
+
+ name = "foo"
"#)
.file("src/bar/not-a-manifest", "");